package com.example.mybatisee.dao;

import com.example.mybatisee.model.UserInfo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
class UserInfoMapperTest {

    @Resource
    private UserInfoMapper userInfoMapper;

    @Test
    //@Transactional
    void addUser() {
        UserInfo userInfo = new UserInfo();
        userInfo.setUsername("顾淇煞笔");
        userInfo.setPassword("无语无语无语");

        int result = userInfoMapper.addUser(userInfo);
        System.out.println(result);
    }

    @Test
    void getUserInfoById() {
        UserInfo userInfo = userInfoMapper.getUserInfoById(1);
        System.out.println(userInfo);
    }

    @Test
    void getAll() {
        List<UserInfo> list = userInfoMapper.getAll();
        list.forEach(System.out::println);
    }

    @Test
    void delByIdInt() {
        int result = userInfoMapper.delByIdInt(6);
        System.out.println(result);
    }

    @Test
    void update() {
        int result = userInfoMapper.update(1,"闫鑫");
        System.out.println(result);
    }

    @Test
    void getFull() {
        UserInfo userInfo = userInfoMapper.getFull(1);
        System.out.println(userInfo);
    }
}